package com.ec.vs.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import jakarta.validation.constraints.*;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * 预约信息视图对象（用于API交互的数据传输）
 */
@Data
@ApiModel(value = "VsAppointmentVo", description = "预约信息视图对象")
public class VsAppointmentVo {
    @ApiModelProperty(value = "预约记录主键ID", example = "1001", notes = "新增时无需传入，更新时必填")
    @Positive(message = "预约ID必须为正整数")
    private Long id;

    @ApiModelProperty(value = "用户ID", example = "2001", required = true)
    @NotNull(message = "用户ID不能为空")
    @Positive(message = "用户ID必须为正整数")
    private Long userId;

    @ApiModelProperty(value = "预约人姓名", example = "张三", required = true)
    @NotBlank(message = "预约人姓名不能为空")
    @Size(min = 2, max = 20, message = "姓名长度必须在2-20个字符之间")
    private String name;

    @ApiModelProperty(value = "预约人手机号", example = "13900139000", required = true)
    @NotBlank(message = "手机号不能为空")
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式不正确")
    private String mobile;

    @ApiModelProperty(value = "预约时间（格式：yyyy-MM-dd HH:mm:ss）", example = "2025-09-01 10:00:00", required = true)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @NotNull(message = "预约时间不能为空")
    @Future(message = "预约时间必须是未来时间")
    private LocalDateTime time;

    @ApiModelProperty(value = "预约人数", example = "3", required = true)
    @NotNull(message = "预约人数不能为空")
    @Min(value = 1, message = "预约人数至少为1人")
    @Max(value = 20, message = "预约人数最多不超过20人")
    private Integer numberOfPeople;

    @ApiModelProperty(value = "预约状态", example = "0", required = true,
            notes = "0-待确定，1-待完成，2-取消，3-过期，4-完成")
    @NotNull(message = "预约状态不能为空")
    @Min(value = 0, message = "预约状态值必须在0-4之间")
    @Max(value = 4, message = "预约状态值必须在0-4之间")
    private Integer status;

    @ApiModelProperty(value = "创建时间", example = "2025-07-20 09:30:00",
            notes = "系统自动生成，前端无需传入")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    @ApiModelProperty(value = "更新时间", example = "2025-07-20 15:45:00",
            notes = "系统自动更新，前端无需传入")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;

    @ApiModelProperty(value = "预约类型", example = "0", required = true,
            notes = "0-探访，1-参观")
    @NotNull(message = "预约类型不能为空")
    @Min(value = 0, message = "预约类型值必须为0或1")
    @Max(value = 1, message = "预约类型值必须为0或1")
    private Integer type;

    @ApiModelProperty(value = "老人ID（仅探访预约时必填）", example = "101", required = false)
    private Long elderId;

    @ApiModelProperty(value = "老人姓名（仅探访预约时返回）", example = "李奶奶")
    private String elderName;
}
